﻿using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _14块操作
{
    public static class MyBlockTableRecord
    {
        //第一块
        private static string block1Name = "Block1";
        public static string Block1Name
        {
            get { return MyBlockTableRecord.block1Name; }
            set { MyBlockTableRecord.block1Name = value; }
        }
        private static List<Entity> block1Ents = new List<Entity>();
        public static List<Entity> Block1Ents
        {
            get
            {
                Circle cicle = new Circle(Point3d.Origin, Vector3d.ZAxis, 10);
                Line line1 = new Line(new Point3d(-10, 0, 0), new Point3d(10, 0, 0));
                Line line2 = new Line(new Point3d(0, 10, 0), new Point3d(0, -10, 0));
                block1Ents.Add(cicle);
                block1Ents.Add(line1);
                block1Ents.Add(line2);
                return MyBlockTableRecord.block1Ents;
            }
        }
        private static ObjectId block1Id = ObjectId.Null;
        public static ObjectId Block1Id
        {
            get { return MyBlockTableRecord.block1Id; }
            set { MyBlockTableRecord.block1Id = value; }
        }

        //注视样式块1
        private static string dimBlock1Name = "dim1";
        public static string DimBlock1Name
        {
            get { return MyBlockTableRecord.dimBlock1Name; }
            set { MyBlockTableRecord.dimBlock1Name = value; }
        }
        private static List<Entity> dimBlock1Ents = new List<Entity>();
        public static List<Entity> DimBlock1Ents
        {
            get 
            {
                Line line1 = new Line(Point3d.Origin,new Point3d(-3.9,0,0));
                Line line2 = new Line(Point3d.Origin,new Point3d(-3.9,0.66,0));
                Line line3 = new Line(Point3d.Origin, new Point3d(-3.9, -0.66, 0));
                dimBlock1Ents.Add(line1);
                dimBlock1Ents.Add(line2);
                dimBlock1Ents.Add(line3);
                return MyBlockTableRecord.dimBlock1Ents; 
            }
        }
        private static ObjectId dimBlock1Id = ObjectId.Null;
        public static ObjectId DimBlock1Id
        {
            get { return MyBlockTableRecord.dimBlock1Id; }
            set { MyBlockTableRecord.dimBlock1Id = value; }
        }

        //属性快
        private static string attrBlock1Name = "AttrBlock1";

        public static string AttrBlock1Name
        {
            get { return MyBlockTableRecord.attrBlock1Name; }
            set { MyBlockTableRecord.attrBlock1Name = value; }
        }
        private static List<Entity> attrBlock1Ents = new List<Entity>();

        public static List<Entity> AttrBlock1Ents
        {
            get
            {
                //块的图形对象
                Circle cicle = new Circle(Point3d.Origin, Vector3d.ZAxis, 10);
                Line line1 = new Line(new Point3d(-10, 0, 0), new Point3d(10, 0, 0));
                Line line2 = new Line(new Point3d(0, 10, 0), new Point3d(0, -10, 0));
                //属性定义
                AttributeDefinition attr = new AttributeDefinition();
                attr.Position = new Point3d(12, 2, 0);
                attr.Tag = "编号";
                attr.Prompt = "天线编号";
                attr.TextString = "ANT-05";
                attr.Height = 6;
                AttributeDefinition attr2 = new AttributeDefinition();
                attr2.Position = new Point3d(12, -8, 0);
                attr2.Tag = "功率";
                attr2.Prompt = "功率大小";
                attr2.TextString = "5.0dBm";
                attr2.Height = 6;
                attrBlock1Ents.Add(cicle);
                attrBlock1Ents.Add(line1);
                attrBlock1Ents.Add(line2);
                attrBlock1Ents.Add(attr);
                attrBlock1Ents.Add(attr2);
                return MyBlockTableRecord.attrBlock1Ents;
            }
        }
        private static ObjectId attrBlock1Id = ObjectId.Null;

        public static ObjectId AttrBlock1Id
        {
            get { return MyBlockTableRecord.attrBlock1Id; }
            set { MyBlockTableRecord.attrBlock1Id = value; }
        }
    }
}
